import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { SheetSearchVO, SheetSearchForm, SheetSearchQuery } from '@/api/sheet/sheetSearch/types';

/**
 * 查询应用搜索列表
 * @param query
 * @returns {*}
 */

export const listSheetSearch = (query?: SheetSearchQuery): AxiosPromise<SheetSearchVO[]> => {
  return request({
    url: '/system/sheetSearch/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询应用搜索详细
 * @param sheetSearchId
 */
export const getSheetSearch = (sheetSearchId: string | number): AxiosPromise<SheetSearchVO> => {
  return request({
    url: '/system/sheetSearch/' + sheetSearchId,
    method: 'get'
  });
};

/**
 * 新增应用搜索
 * @param data
 */
export const addSheetSearch = (data: SheetSearchForm) => {
  return request({
    url: '/system/sheetSearch',
    method: 'post',
    data: data
  });
};

/**
 * 修改应用搜索
 * @param data
 */
export const updateSheetSearch = (data: SheetSearchForm) => {
  return request({
    url: '/system/sheetSearch',
    method: 'put',
    data: data
  });
};

/**
 * 删除应用搜索
 * @param sheetSearchId
 */
export const delSheetSearch = (sheetSearchId: string | number | Array<string | number>) => {
  return request({
    url: '/system/sheetSearch/' + sheetSearchId,
    method: 'delete'
  });
};
